package org.example.service;

import org.example.entity.Pinjia;
import org.example.mapper.Pinjiamapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class PinjiaService {
    @Autowired
    Pinjiamapper pinjiamapper;
    /**
     * 新增
     * @param pinjia
     */
    public void xz(Pinjia pinjia) {
        pinjia.setTime(LocalDateTime.now());
        pinjiamapper.xz(pinjia);
    }

    /**
     * 查询
     * @param id
     * @return
     */
    public String cx(int id) {

        return pinjiamapper.cx(id);
    }

    /**
     * 删除
     * @param id
     */
    public void sc(int id) {
        pinjiamapper.pj(id);
    }

    /**
     * 查询评价
     * @param id
     * @return
     */
    public List<Pinjia> cxsy(int id) {
       return pinjiamapper.cxsy(id);
    }
}
